package com.yzs.base.view

import android.content.Context
import android.os.Build
import android.util.AttributeSet
import android.view.View
import android.view.ViewGroup
import me.jessyan.autosize.utils.ScreenUtils

/**
 * yzs
 * 12/16/20.
 * 适配状态栏的高度
 */
class FitStatusBarView  @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0):View(context, attrs, defStyleAttr) {

    override fun setLayoutParams(params: ViewGroup.LayoutParams?) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            params!!.height = ScreenUtils.getStatusBarHeight()
        }
        super.setLayoutParams(params)
    }
}